package com.lace.ctrl.admin.web.company.controller;


import com.baomidou.mybatisplus.plugins.Page;
import com.lace.common.entity.TbCompanyInfo;
import com.lace.ctrl.admin.web.company.provider.TbCompanyProvider;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author Mybatis-plus generator codes
 * @since 2018-07-15
 */
@Controller
@RequestMapping("/v1/tbCompanyInfos")
public class TbCompanyInfoController {

    @Autowired
    private TbCompanyProvider tbCompanyProvider;


    @GetMapping
    @ResponseBody
    public Object selectAll(){
        return  tbCompanyProvider.selectAll();
    }


    @GetMapping("bysql")
    @ResponseBody
    public Object selectBySql(){
        return tbCompanyProvider.selectBySql();
    }

    @GetMapping("pagebysql")
    @ResponseBody
    public Object selectPageBySql(){
        return tbCompanyProvider.selectPageBySql(1 , 10);
    }

    @GetMapping("{id}")
    @ResponseBody
    public Object findOne(@PathVariable Long id){
        return  tbCompanyProvider.findOne(id);
    }

    @PostMapping
    @ResponseBody
    public Object insert(@RequestBody TbCompanyInfo tbCompanyInfo){
        return tbCompanyProvider.insert(tbCompanyInfo);
    }

    @DeleteMapping("{id}")
    @ResponseBody
    public Object deleteOne(@PathVariable Long id){
        tbCompanyProvider.deleteOne(id);
        return "success";
    }

}

